package com.yyh.synctool.server.rmq;

import com.yyh.pojo.SyncParam;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 库存任务 的 消费者
 *
 * @author xuan
 * @date 2021/12/17
 */
@Component
@RabbitListener(queues = "stock")
public class ConsumerForStock
{
    @RabbitHandler
    public void process(List<Map> data) {
        data.forEach(e -> System.out.println(e));

    }

    @RabbitHandler
    public void process(SyncParam<List<Map>> syncParam) {
        System.out.println("供商id："+syncParam.getGsid());
        System.out.println("凭证："+syncParam.getCredential());
        System.out.println("数据：");
        System.out.println(syncParam.getData());

    }
}
